package com.zhongwang.business.module.invoiceManage.dao;

import com.zhongwang.business.module.fileManage.model.FileModel;
import com.zhongwang.business.module.invoiceManage.model.InvoiceInfo;
import com.zhongwang.business.module.invoiceManage.model.InvoiceListModel;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@Repository
public interface InvoiceListDao {

    //合同基本款票信息列表(所有)
    List<InvoiceListModel> invoiceList1(InvoiceListModel model);

    //合同基本款票信息列表(组员组长自己完结的合同)
    List<InvoiceListModel> invoiceList3(InvoiceListModel loginUName);

    //合同款票信息    待审核列表
    List<InvoiceListModel> invoiceExamineList(InvoiceListModel model);

    //合同款票信息   提交列表
    List<InvoiceListModel> invoiceSumbitList(InvoiceListModel model);

    // 已审核的 款票列表
    List<InvoiceListModel> appedInvoiceExamineList(InvoiceListModel model);

    //查询单条合同包含项目
    List<InvoiceListModel> invoiceList2(Integer conId);

    //查询单条合同基本款票信息
    InvoiceListModel selectConstractInfoById(Integer conId);

    //查询合同款项回款列表
    List<InvoiceListModel> selectReturnMoneyInfoByConId(Integer conId);

    //查询单项回款的详细信息(非总包)
    InvoiceListModel selectRmiByConIdAndRmiMoneyType(@Param("conId") Integer conId,
                                                     @Param("rmiMoneyType") Integer rmiMoneyType
                                                    );
    //查询单项回款的详细信息（总包）
    InvoiceListModel selectZBRmiByConIdAndRmiMoneyType(@Param("conId") Integer conId,
                                                     @Param("rmiMoneyType") Integer rmiMoneyType
    );

    //修改回款信息(非总包)
    int updateRmiInfoByConIdAndRmiMoneyType(@Param("conId") Integer conId,
                                            @Param("rmiMoneyType") Integer rmiMoneyType,
                                            @Param("singleAlreadyMoney")BigDecimal singleAlreadyMoney,
                                            @Param("singleRmiDebtsMoney")BigDecimal singleRmiDebtsMoney,
                                            @Param("singleRmiBadMoney")BigDecimal singleRmiBadMoney,
                                            @Param("rmiExpectDate")Date rmiExpectDate

                                           );

    //修改回款信息(总包)
    int updateZBRmiInfoByConIdAndRmiMoneyType(@Param("conId") Integer conId,
                                            @Param("rmiMoneyType") Integer rmiMoneyType,
                                            @Param("singleAlreadyMoney")BigDecimal singleAlreadyMoney,
                                            @Param("singleRmiDebtsMoney")BigDecimal singleRmiDebtsMoney,
                                            @Param("singleRmiBadMoney")BigDecimal singleRmiBadMoney,
                                            @Param("rmiExpectDate")Date rmiExpectDate

    );

    //查询单合同的发票信息
    List<InvoiceListModel> selectInvInfoByConId(Integer conId);

    List<FileModel> selectFileListByInvId(Integer invId);

    int deleteInvoiceByInvId(Integer invId);

    int addInvoice(InvoiceInfo info);

    InvoiceListModel selectInvIdByInvCode(String invCode);

    //查询单项回款的详细信息（总包）
    List<InvoiceListModel> selectReturnZBMoneyInfoByConId(Integer conId);


    //修改款票状态
    int updkpStatus(InvoiceListModel model);

    //add 审核单据
    int addSheetDetail(InvoiceListModel model_sheet);

    //当前的账号所在的流程节点
    List<InvoiceListModel> selAppNodeInfoByUserId(Integer uid);

    //员工级别 查流程
    List<InvoiceListModel> selAppNodeInfo(Integer orderNo);

    //查询我当前人员账号的父级id
    int selNowLevelByUserId(Integer id);

    //获取父级id的审批级别、人员id
    InvoiceListModel selNextLevelUserByPId(int id);

    int addVerifyProcess(InvoiceListModel model);

    //修改审批记录
    int updVerifyProcess(InvoiceListModel model);

    //当前的审批节点的信息
    InvoiceListModel selectVerifyProcess(Integer id);

    //修改合同款票状态
    int updContractKPStatuse(InvoiceListModel model);

    //获取孩子id的审批级别、人员id
    InvoiceListModel selNextUserByNgInfo(Integer id);

    //修改 款票状态ByConId  为 保存未提交 1   款票登记人
    int upkpStatusByConId(@Param("conId")Integer conId);

    List<InvoiceListModel> selectAppProcessByConId(Integer conId);

    //发票已收总额
    int selectAlreadySumAmount(Integer conId);

    //总应收
    int selectSumys(Integer conId);

    //修改款票任务状态
    int updateKpTask(InvoiceListModel invoiceListModel);




    //查询合同信息
    InvoiceListModel selectContractByConId(Integer conId);

    //添加合同表 回款编辑人
    void addEditUser(@Param("keditUserName")String keditUserName,@Param("conId")Integer conId);

    //添加合同表 发票编辑人
    void addPeditUser(@Param("peditUserName")String peditUserName,@Param("conId")Integer conId);

    //修改发票信息
    int updateInvoiceByInvId(@Param("invId")Integer invId,
                             @Param("invCode")String invCode,
                             @Param("invGoodsName")String invGoodsName,
                             @Param("invAmount")BigDecimal invAmount,
                             @Param("invDate") Date invDate);

    BigDecimal selectAmountByInvId(Integer invId);

    int saveUpdateMoney(InvoiceListModel model);

    int beginKpTask(InvoiceListModel invoiceListModel);

    List<InvoiceListModel> selAppList(Integer conId);

    int selectUserLevelByUserId(int loginUid);

    List<InvoiceListModel> selectProjecByConId(Integer conId);

    InvoiceListModel selectConByConId(Integer conId);

    InvoiceListModel selectFPByInvId(Integer invId);

    List<InvoiceListModel> selectLikeTest(String sellCode);
}
